Skip to content

feat(profiling): Support sample v2 profiles for Android - #118849

Merged
markushi merged 16 commits into
masterfrom
markushi/profiling-sample-v2-jvm-deobfuscation
Jul 13, 2026
Merged

feat(profiling): Support sample v2 profiles for Android#118849
markushi merged 16 commits into
masterfrom
markushi/profiling-sample-v2-jvm-deobfuscation

Conversation

@markushi

@markushi markushi commented Jul 1, 2026

Copy link
Copy Markdown
Member

The Android SDK can now emit sample v2 profiles in addition to the legacy android trace format. This wires the profiling pipeline to be able to process both.

The whole pipeline previously always assumed that platform="android" provided a profile in the Android trace format - regardless if version="2" was set or not.

platform: "java" profiles (aka profiles from backend services) are intentionally not deobfuscated for now, but support could be easily added.

Also removes get_data_category, dead code since #81481.

Note

vroom and vroomrs need to be updated as well to support the sample v2 Android format.
See getsentry/vroom#672 (was automatically deployed earlier this week)
and getsentry/vroomrs#93 (landed in 0.1.22, which is bumped in this PR as well)

Testing

  • Unit tests for the classifiers, frame conversion and the sample v2 merge/stack-remap (inline expansion + native passthrough).
  • Symbolicator integration tests for sample v2 (basic + inline) plus a full process_profile_task run.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 1, 2026
@linear-code

linear-code Bot commented Jul 2, 2026

Copy link
Copy Markdown

JAVA-601

Deobfuscation previously handled only the legacy android trace (methods)
format. Route it through is_android_trace_format / is_jvm_frame so sample
v2 JVM frames are deobfuscated too: merge the results onto the matching
frames and rebuild the stacks, expanding inlines. Native frames are left
untouched.

Also remove get_data_category, dead code since #81481.
…ring

Rename the profile format version identifier from "2-android-trace" to
"2.android-trace" to match the agreed-upon naming.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread src/sentry/profiles/java.py
markushi and others added 3 commits July 2, 2026 16:12
vroomrs 0.1.21 accepts a version argument in profile_chunk_from_json_str,
letting it deserialize directly to the right chunk format instead of
inferring it. Keep passing platform as a fallback for legacy android
trace chunks that don't carry a version yet.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread src/sentry/profiles/task.py Outdated
markushi and others added 5 commits July 3, 2026 09:34
Android trace profiles can arrive with a missing or wrongly set version
(e.g. a sample "2"), so the version alone can't be trusted to identify
the format. Make is_android_trace_format probe the profile structure:
only the android trace format stores its frames in "methods".

Consult is_android_trace_format before any sample v1/v2 version checks
(profile type, duration calculation, normalization) so mislabeled trace
profiles are routed correctly, and pass the normalized version to
vroomrs chunk deserialization instead of the payload value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread src/sentry/profiles/java.py
Comment thread src/sentry/profiles/task.py
Comment thread src/sentry/profiles/java.py
@markushi
markushi marked this pull request as ready for review July 3, 2026 13:25
@markushi
markushi requested a review from a team as a code owner July 3, 2026 13:25

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7aca00c. Configure here.

Comment thread src/sentry/profiles/task.py
Comment thread src/sentry/profiles/task.py
@markushi
markushi marked this pull request as draft July 3, 2026 13:33

@manessaraj manessaraj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

markushi and others added 2 commits July 9, 2026 11:21
Upgrade vroomrs from 0.1.21 to the newly published 0.1.22 release, which
carries the version-based chunk deserialization API used by sample v2 JVM
deobfuscation. This replaces the local development build that was previously
installed in the environment.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@markushi
markushi marked this pull request as ready for review July 9, 2026 11:44
@markushi
markushi requested a review from a team as a code owner July 9, 2026 11:44
Comment thread src/sentry/profiles/task.py Outdated
Comment thread src/sentry/profiles/java.py
Comment thread src/sentry/profiles/task.py Outdated
Comment thread src/sentry/profiles/task.py Outdated
markushi added 2 commits July 9, 2026 17:20
…chunk"

is_android_trace_format() matches legacy android transaction profiles too,
so they were tagged as android_chunk. Restore the profiler_id distinction:
only continuous-profiling chunks carry a profiler_id.
Restore the single-condition form and only skip genuine sample v2 profiles on
android, since the version field can be faulty on legacy android trace profiles
that do carry device classification.
@markushi
markushi merged commit 848a797 into master Jul 13, 2026
88 checks passed
@markushi
markushi deleted the markushi/profiling-sample-v2-jvm-deobfuscation branch July 13, 2026 08:29
0xadam-brown added a commit to getsentry/sentry-java that referenced this pull request Jul 24, 2026
Commit updates the platform used with ANR profiles from Java to Android so that we can properly bill ANR profiling under UI Profile Hours rather than Continuous Profile Hours.

Depends on the updates made in [Relay #6183](getsentry/relay#6183), [getsentry #118849](getsentry/sentry#118849), [vroomrs #93](getsentry/vroomrs#93), and [vroom #672](getsentry/vroom#672).
0xadam-brown added a commit to getsentry/sentry-java that referenced this pull request Jul 28, 2026
Commit updates the platform used with ANR profiles from Java to Android so that we can properly bill ANR profiling under UI Profile Hours rather than Continuous Profile Hours.

Depends on the updates made in [Relay #6183](getsentry/relay#6183), [getsentry #118849](getsentry/sentry#118849), [vroomrs #93](getsentry/vroomrs#93), and [vroom #672](getsentry/vroom#672).

# Conflicts:
#	CHANGELOG.md
0xadam-brown added a commit to getsentry/sentry-java that referenced this pull request Jul 28, 2026
Commit updates the platform used with ANR profiles from Java to Android so that we can properly bill ANR profiling under UI Profile Hours rather than Continuous Profile Hours.

Depends on the updates made in [Relay #6183](getsentry/relay#6183), [getsentry #118849](getsentry/sentry#118849), [vroomrs #93](getsentry/vroomrs#93), and [vroom #672](getsentry/vroom#672).

# Conflicts:
#	CHANGELOG.md
0xadam-brown added a commit to getsentry/sentry-java that referenced this pull request Jul 29, 2026
#5836)

Commit updates the platform used with ANR profiles from Java to Android so that we can properly bill ANR profiling under UI Profile Hours rather than Continuous Profile Hours.

Depends on the updates made in [Relay #6183](getsentry/relay#6183), [getsentry #118849](getsentry/sentry#118849), [vroomrs #93](getsentry/vroomrs#93), and [vroom #672](getsentry/vroom#672).

Co-authored-by: Markus Hintersteiner <markus.hintersteiner@sentry.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants